<!DOCTYPE html>
<html lang="en">

<head>
    <title></title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <block name="style">
        <link rel="stylesheet" href="__MYCSS__/main.min.css">
    </block>
</head>
<extend name="Public/base" />
<block name="body">

    <body>
        <ol class="breadcrumb">
            <li><a href="#">商务管理</a></li>
            <li class="active">技术列表</li>
        </ol>
        <p>
            <a class="btn btn-primary" role="button" data-toggle="collapse" href="#collapseExample" aria-expanded="false" aria-controls="collapseExample">查询</a>
        </p>
        <div class="collapse" id="collapseExample">
            <div class="well">
                <form action="{:U('lst')}" method="POST">
                    <div class="row">
                        <!--<div class="col-lg-3">
                            <div class="form-group">
                                <label for="exampleInputName2">客户名称：</label>
                                <select class="form-control" name="khmc">
                                    <option value="">--请选择--</option>
                                        <volist name="khmc_arr" id="khmc">
                                            <option value="{$khmc}">{$khmc}</option>
                                        </volist>
                                 </select>
                            </div>
                        </div>-->
                        <div class="col-lg-2">
                            <div class="form-group">
                                <label for="exampleInputName2">所属年份：</label>
                                <select class="form-control father_select year_select" name="year">
                                    <option value="">--请选择--</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-lg-2">
                            <div class="form-group">
                                <label for="exampleInputName2">所属月份</label>
                                <select class="form-control son_select month_select" name="month" disabled="disabled">
                                    <option value="">--请选择--</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-lg-2" style="margin-top: 25px;">
                            <button type="submit" class="btn btn-success">查询</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class=" jsgl_container">
            <volist name="lsts" id="lst">
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" data-parent="#accordion" href="#{$key}" aria-expanded="true" aria-controls="kehu1">{$key}</a>
                            </h4>
                        </div>
                        <div id="{$key}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
                            <div class="panel-body">
                                <div>
                                    <div class="row">
                                        <div class="col-lg-4">
                                            <p class="jsgl_title">客户资源</p>
                                            <volist name="lst['khzy']" id="khzy">
                                                <div class="row">
                                                    <div class=" col-lg-12">
                                                        <div class="kh_card">
                                                            <div class="row">
                                                                <div class="col-lg-6">
                                                                    <strong>客户名称</strong>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    {$khzy['khmc']}
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <strong>业务区域</strong>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    {$khzy['ywqy']}
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <strong>运营商类型</strong>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    {$khzy['yyslx']}
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <strong>时间区域</strong>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    {$khzy['rqqj']}
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <strong>所用天数</strong>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    {$khzy['ts_sum']}
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    <strong>使用量总和</strong>
                                                                </div>
                                                                <div class="col-lg-6">
                                                                    {$khzy['gs_sum']}
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </volist>
                                        </div>
                                        <div class="col-lg-4">
                                            <p class="jsgl_title">带宽资源
                                                <button type="button" class="btn btn-success btn-xs pull-right dkzyaddbtn" data-id="{$lst['khzy'][0]['all_kh_ids']}" data-form="form1">
                                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                                                添加
                                            </button>
                                                <button type="button" class="btn btn-success btn-xs pull-right ftthddbtn" data-id="{$lst['khzy'][0]['all_kh_ids']}" data-value="{$lst['khzy'][0]['ftth_sy']}"
                                                    data-form="form1">
                                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
                                                ftth使用量(已使用{$lst['khzy'][0]['ftth_sy']}%)
                                            </button>
                                            </p>
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="table-responsive">
                                                        <table class="table jsgl_table_dkzy">
                                                            <thead>
                                                                <tr>
                                                                    <th>供应商名称</th>
                                                                    <th>属性</th>
                                                                    <th>带宽所属时间区域</th>
                                                                    <th>天数</th>
                                                                    <th>带宽数量</th>
                                                                    <th>使用量</th>
                                                                    <th>操作</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <volist name="lst['dkzy']" id="dkzy">
                                                                    <tr>
                                                                        <td>{$dkzy['dkgys']}</td>
                                                                        <td>{$dkzy['yyslx']}</td>
                                                                        <td>{$dkzy['rqqj']}</td>
                                                                        <td>{$dkzy['ts_sum']}</td>
                                                                        <td>{$dkzy['gs']}</td>
                                                                        <if condition="$dkzy['sy']">
                                                                            <td><a class="updatesyl" data-id="{$dkzy['id']}" style="cursor: pointer">{$dkzy['sy']}</a></td>
                                                                             <else /><td><a class="updatesyl" data-id="{$dkzy['id']}" style="cursor: pointer">0</a></td>
                                                                        </if>
                                                                        <td><a href="{:U('dk_cs_del',array('kh_ids'=>$lst['khzy'][0]['all_kh_ids'],'dk_id'=>$dkzy['id']))}">删除</a></td>
                                                                    </tr>
                                                                </volist>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-lg-4">
                                            <p class="jsgl_title">传输资源
                                                <button type="button" class="btn btn-success btn-xs pull-right cszyaddtbn" data-id="{$lst['khzy'][0]['all_kh_ids']}" data-form="form1">
                                                <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>添加
                                            </button>
                                            </p>
                                            <div class="row">
                                                <div class="col-lg-12">
                                                    <div class="table-responsive">
                                                        <table class="table jsgl_table_cszy">
                                                            <thead>
                                                                <tr>
                                                                    <th>传输供应商名称</th>
                                                                    <th>传输路径</th>
                                                                    <th>传输所属时间区域</th>
                                                                    <th>天数</th>
                                                                    <th>个数</th>
                                                                    <th>操作</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                <volist name="lst['cszy']" id="cszy">
                                                                    <tr>
                                                                        <td>{$cszy['csgys']}</td>
                                                                        <td>{$cszy['cslj']}</td>
                                                                        <td>{$cszy['rqqj']}</td>
                                                                        <td>{$cszy['ts_sum']}</td>
                                                                        <td>{$cszy['gs']}</td>
                                                                        <td><a href="{:U('dk_cs_del',array('kh_ids'=>$lst['khzy'][0]['all_kh_ids'],'cs_id'=>$cszy['id']))}">删除</a></td>
                                                                    </tr>
                                                                </volist>
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </volist>
        </div>


        <!--添加修改使用量面板-->
        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="sylModal" aria-labelledby="mySmallModalLabel">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <form class="public_form" action="{:U('dkzy_sy')}" method="post">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">添加使用量</h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-group">
                                <label for="sy">使用量</label>
                                <input type="text" class="form-control" id="sy" name="sy">
                            </div>
                        </div>
                        <input type="hidden" id="shiyongliang" name="dk_id">
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary">添加</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--添加带宽资源-->
        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="addkdzyModal" aria-labelledby="mySmallModalLabel">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <form class="public_form" action="{:U('kh_dk_cs_save')}" method="post">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">添加宽带资源</h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-group">
                                <label for="exampleInputName2">带宽供应商：</label>
                                <select class="form-control father_select" id="adddkgys1">
                                <option value="">--请选择--</option>
                            </select>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2 ">其他信息：</label>
                                <select class="form-control son_select" name="dk_ids" id="adddkgys2" disabled="disabled">
                                    <option value="">--请选择--</option>
                                </select>
                            </div>
                        </div>
                        <input type="hidden" name="kh_ids" id="kh_dk_ids" value="{$lst['khzy'][0]['all_kh_ids']}" />
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary adddkgysbtn" disabled>添加</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <!--添加传输资源面板-->
        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="addcszyModal" aria-labelledby="mySmallModalLabel">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <form class="public_form" action="{:U('kh_dk_cs_save')}" method="post">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">添加传输资源</h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-group">
                                <label for="exampleInputName2">带宽供应商：</label>
                                <select class="form-control" id="addcszy1">
                                <option value="">--请选择--</option>
                            </select>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2">其他信息：</label>
                                <select class="form-control" name="cs_ids" id="addcszy2">
                                <option value="">--请选择--</option>
                            </select>
                            </div>
                        </div>
                        <input type="hidden" name="kh_ids" id="kh_cs_ids" value="{$lst['khzy'][0]['all_kh_ids']}" />
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary addcsgysbtn" disabled>添加</button>
                        </div>
                    </form>
                </div>
            </div>

        </div>
        <!--添加ftth面板-->
        <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" id="addftthModal" aria-labelledby="mySmallModalLabel">
            <div class="modal-dialog modal-sm" role="document">
                <div class="modal-content">
                    <form class="public_form" action="{:U('ftth_sy')}" method="post">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">添加ftth使用量</h4>
                        </div>
                        <div class="modal-body">
                            <div class="form-group">
                                <label for="ftth">使用量%</label>
                                <input type="text" class="form-control" id="ftth" name="ftth_sy">
                            </div>
                        </div>
                        <input type="hidden" id="kh_ftth_ids" name="kh_ids">
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary">添加</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <script src="__MYJS__/main.min.js"></script>
        <script src="__MYJS__/main.js"></script>
        <script src="__MYJS__/validator.js"></script>
        <script src="__MYJS__/table.js"></script>
        <script>
            var zdytable = new window.zdytable();
        </script>


        <script>
            (function () {
                // 修改使用量事件
                $("body").on("click", ".updatesyl", function (e) {
                    e.stopPropagation()
                    $("#sy").val($(this).html())
                    var id = $(this).attr("data-id");
                    $("#shiyongliang").val(id);
                    $('#sylModal').modal('show')
                })
                var dkzyobj = {};
                var dkzyobj2 = {};
                var cszyobj = {};
                var cszyobj2 = {};
                var selectobj = {};
                var dkarr = [];
                var csarr = [];
                var forms;
                Array.prototype.removeByValue = function (val) {
                    for (var i = 0; i < this.length; i++) {
                        if (this[i] == val) {
                            this.splice(i, 1);
                            break;
                        }
                    }
                }
                // 向后台请求数据
                $.ajax({
                    url: "{:U('get_dkzy')}",
                    type: "GET",
                    success: function (result) {
                        dkzyobj = result;
                        for (var i in result) {
                            $("#adddkgys1").append("<option class='dkzy1' value='" + i + "'>" +
                                i + "</option>");
                        }
                    }
                })
                $.ajax({
                    url: "{:U('get_cszy')}",
                    type: "GET",
                    success: function (result) {
                        cszyobj = result;
                        for (var i in result) {
                            $("#addcszy1").append("<option class='cszy1' value='" + i + "'>" +
                                i + "</option>");
                        }
                    }
                })
                //添加带宽资源按钮事件
                $(".dkzyaddbtn").on("click", function () {
                    $('#addkdzyModal').modal('show');
                    $("#kh_dk_ids").val($(this).attr("data-id"))
                    // 清空下拉框里面的数据
                    $("#adddkgys1").val("");
                    $("#adddkgys2>.dkzy2").remove();
                    $("#adddkgys2").attr("disabled", true);

                });
                // 当第一个下拉框改变的时候触发的事件
                $("#adddkgys1").change(function () {
                    $("#adddkgys2>.dkzy2").remove();
                    $("#adddkgys2").attr("disabled", false);
                    dkzyobj2 = dkzyobj[$(this).val()];
                    // 填充第二个下拉框的数据
                    $(dkzyobj2).each(function (index, val) {
                        $("#adddkgys2").append("<option class='dkzy2'data-index='" + index +
                            "' value='" + this.id + "'>" + this.yyslx + "&nbsp;&nbsp;" + this.rqqj +
                            "&nbsp;&nbsp;" + this.ts_sum + "天&nbsp;&nbsp;" + this.gs + "G" +
                            "</option>");
                    })
                });
                $("#adddkgys2").change(function () {
                    if ($(this).val() != "") {
                        selectobj = dkzyobj2[$(this).find(":selected").attr("data-index")];
                        $(".adddkgysbtn").attr("disabled", false);
                    } else {
                        $(".adddkgysbtn").attr("disabled", true);
                    }

                });
                // 添加传输资源按钮事件
                $(".cszyaddtbn").on("click", function () {
                    $('#addcszyModal').modal('show');
                    $("#kh_cs_ids").val($(this).attr("data-id"))
                    $("#addcszy1").val("");
                    $("#addcszy2>.cszy2").remove();
                    $("#addcszy2").attr("disabled", true);
                });

                $("#addcszy1").change(function () {
                    $("#addcszy2>.cszy2").remove();
                    $("#addcszy2").attr("disabled", false);
                    cszyobj2 = cszyobj[$(this).val()];
                    $(cszyobj2).each(function (index, val) {
                        $("#addcszy2").append("<option class='cszy2' data-index='" + index +
                            "' value='" + this.id + "'>" + this.cslj + "&nbsp;&nbsp;" +
                            this.rqqj +
                            "&nbsp;&nbsp;" + this.ts_sum + "天&nbsp;&nbsp;" + this.gs +
                            "G&nbsp;&nbsp;" +
                            "</option>");

                    })
                });
                $("#addcszy2").change(function () {
                    if ($(this).val() != "") {
                        selectobj = cszyobj2[$(this).find(":selected").attr("data-index")];
                        $(".addcsgysbtn").attr("disabled", false);
                    } else {
                        $(".addcsgysbtn").attr("disabled", false);
                    }
                });
                //添加ftth按钮事件
                $(".ftthddbtn").on("click", function () {
                    $('#addftthModal').modal('show');
                    $("#kh_ftth_ids").val($(this).attr("data-id"))
                    $("#ftth").val($(this).attr("data-value"))
                });
            })()
        </script>
    </body>
</block>

</html>